package com.example.webdemo.exception;

import jdk.nashorn.internal.ir.ReturnNode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @Date 2021/6/24 16:38
 * @Created by wangle
 * @Description 处理整个web页面的异常
 */
@Slf4j
@ControllerAdvice
public class globalexception {

    @ExceptionHandler({ArithmeticException.class,NullPointerException.class}) //处理异常
    public  String hundlerexception(Exception e){
        log.info("异常时{}",e);
        return  "login";//视图地址

    }


}
